package com.nju.edu.erp.web.controller;


import com.nju.edu.erp.model.vo.saleSpecific.SaleSpecificInVO;
import com.nju.edu.erp.service.finance.SaleSpecificService;
import com.nju.edu.erp.web.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(path = "/sale-specific")
public class SaleSpecificController {
    private final SaleSpecificService saleSpecificService;
    @Autowired
    SaleSpecificController(SaleSpecificService saleSpecificService){
        this.saleSpecificService=saleSpecificService;
    }

    //@Authorized (roles = {Role.FINANCIAL_STAFF,Role.GM, Role.ADMIN})
    @PostMapping(value = "/specific")
    public Response getSaleSpecific(@RequestBody SaleSpecificInVO saleSpecificInVO)  {
//        List<SaleSpecificOutVO>saleSpecificOutVOS=saleSpecificService.getSaleSpecific(saleSpecificInVO);
//        System.err.println(saleSpecificOutVOS.size());
//        for(int i=0;i<6;i++)
//        System.err.println(saleSpecificOutVOS.get(i).getTotalPrice());
        return Response.buildSuccess(saleSpecificService.getSaleSpecific(saleSpecificInVO));
    }



}